// 格式化中间件
module.exports = (req, res, next) => {
    // 添加统一分页参数
    if (req.method.toLowerCase() == 'get') {
        const { currentPage, pageNum } = req.query
        req.query.currentPage = currentPage ? currentPage * 1 : 1
        req.query.pageNum = pageNum ? pageNum * 1 : 20
    }

    const Ip = req.headers['x-real-ip'] || req.ip
    req.query.ipv4 = Ip
    req.body.ipv4 = Ip

    next()
}